package com.hhh.demo;

/**
 * @author zzzzz
 * @create 08-22
 */
public class Demo3 {
    public static void main(String[] args) {
        String s1 = "疯狂Java";
        String s2 = "疯狂" + "Java";
        //①s2在编译时即可确定s2为"疯狂Java",所以为true
        System.out.println(s1 == s2);
        String str1 = "疯狂";
        String str2 = "Java";
        //final修饰可达到宏替换
//      final  String str1 = "疯狂";
//      final  String str2 = "Java";
        String s3 = str1 + str2;
        //②s3在编译时不会执行宏替换,也不知道s3是"疯狂Java",所以是false
        System.out.println(s1 == s3);
    }

}
